﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Oracle.ManagedDataAccess.Client;



namespace ExportToDWGTool
{
    public partial class DataBaseConnectFrm : Form
    {

        public OracleConnection m_conn = null;

        public DataBaseConnectFrm()
        {
            InitializeComponent();

            this.comboBox1.Items.Add("Oracle");

            this.comboBox1.SelectedIndex = comboBox1.Items.IndexOf("Oracle");

            this.textBox_IP.Text = "47.111.184.108";

            this.textBox_Port.Text = "1521";

            this.textBox_Server.Text = "ORCL";

            this.textBox_Name.Text = "DL_CDDataBase";

            this.textBox_PassWord.Text = "DL_CDDataBase";

        }

        private void button1_Click(object sender, EventArgs e)
        {
            //m_IP = this.textBox_IP.Text;
            //m_Port = this.textBox_Port.Text;
            //m_Server = this.textBox_Server.Text;
            //m_UserName = this.textBox_Name.Text;
            //m_PassWord = this.textBox_PassWord.Text;
            m_conn = OrclDBConn.OpenConn(this.textBox_IP.Text, this.textBox_Port.Text, this.textBox_Server.Text, this.textBox_Name.Text, this.textBox_PassWord.Text);
            if (m_conn != null)
            {
                MessageBox.Show("数据库连接成功！", "提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information);

                
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("数据库连接失败！", "提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
